<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_goods', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('order_id');
            $table->bigInteger('good_id');
            $table->string('title')->comment('商品的名称');
            $table->tinyInteger('number')->comment('商品购买数量');
            $table->decimal('price')->comment('商品购买价格');
            $table->integer('point')->default(0)->comment('商品购买赠送的积分');
            $table->integer('parent')->nullable()->comment('父商品id，取值于商品的parent_id；如果有该值则是值代表的物品的配件');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_goods');
    }
}
